home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / CTBUtilities.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  5.7 KB  |  223 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        CTBUtilities.h
  3.  
  4.      Contains:    Communications Toolbox Utilities interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1988-1993, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CTBUTILITIES__
  19. #define __CTBUTILITIES__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. #ifndef __MIXEDMODE__
  28. #include <MixedMode.h>
  29. #endif
  30. #ifndef __DIALOGS__
  31. #include <Dialogs.h>
  32. #endif
  33. #ifndef __APPLETALK__
  34. #include <AppleTalk.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.     curCTBUVersion                = 2                                /* version of Comm Toolbox Utilities*/
  62. };
  63.  
  64.  
  65. enum {
  66.                                                                 /*    Error codes/types    */
  67.     ctbuGenericError            = -1,
  68.     ctbuNoErr                    = 0
  69. };
  70.  
  71. typedef OSErr                             CTBUErr;
  72.  
  73. enum {
  74.     chooseDisaster                = -2,
  75.     chooseFailed                = -1,
  76.     chooseAborted                = 0,
  77.     chooseOKMinor                = 1,
  78.     chooseOKMajor                = 2,
  79.     chooseCancel                = 3
  80. };
  81.  
  82. typedef unsigned short                     ChooseReturnCode;
  83.  
  84. enum {
  85.     nlOk                        = 0,
  86.     nlCancel                    = 1,
  87.     nlEject                        = 2
  88. };
  89.  
  90. typedef unsigned short                     NuLookupReturnCode;
  91.  
  92. enum {
  93.     nameInclude                    = 1,
  94.     nameDisable                    = 2,
  95.     nameReject                    = 3
  96. };
  97.  
  98. typedef unsigned short                     NameFilterReturnCode;
  99.  
  100. enum {
  101.     zoneInclude                    = 1,
  102.     zoneDisable                    = 2,
  103.     zoneReject                    = 3
  104. };
  105.  
  106. typedef unsigned short                     ZoneFilterReturnCode;
  107.  
  108. enum {
  109.                                                                 /*    Values for hookProc items        */
  110.     hookOK                        = 1,
  111.     hookCancel                    = 2,
  112.     hookOutline                    = 3,
  113.     hookTitle                    = 4,
  114.     hookItemList                = 5,
  115.     hookZoneTitle                = 6,
  116.     hookZoneList                = 7,
  117.     hookLine                    = 8,
  118.     hookVersion                    = 9,
  119.     hookReserved1                = 10,
  120.     hookReserved2                = 11,
  121.     hookReserved3                = 12,
  122.     hookReserved4                = 13,                            /*    "virtual" hookProc items    */
  123.     hookNull                    = 100,
  124.     hookItemRefresh                = 101,
  125.     hookZoneRefresh                = 102,
  126.     hookEject                    = 103,
  127.     hookPreflight                = 104,
  128.     hookPostflight                = 105,
  129.     hookKeyBase                    = 1000
  130. };
  131.  
  132.  
  133. /*    NuLookup structures/constants    */
  134. struct NLTypeEntry {
  135.     Handle                             hIcon;
  136.     Str32                             typeStr;
  137. };
  138. typedef struct NLTypeEntry NLTypeEntry;
  139.  
  140. typedef NLTypeEntry                     NLType[4];
  141. struct NBPReply {
  142.     EntityName                         theEntity;
  143.     AddrBlock                         theAddr;
  144. };
  145. typedef struct NBPReply NBPReply;
  146.  
  147. typedef CALLBACK_API( short , DialogHookProcPtr )(short item, DialogPtr theDialog);
  148. typedef CALLBACK_API( short , NameFilterProcPtr )(const EntityName *theEntity)/*  (22) added const */;
  149. typedef CALLBACK_API( short , ZoneFilterProcPtr )(ConstStr32Param theZone);
  150. typedef STACK_UPP_TYPE(DialogHookProcPtr)                         DialogHookUPP;
  151. typedef STACK_UPP_TYPE(NameFilterProcPtr)                         NameFilterUPP;
  152. typedef STACK_UPP_TYPE(ZoneFilterProcPtr)                         ZoneFilterUPP;
  153. enum { uppDialogHookProcInfo = 0x000003A0 };                     /* pascal 2_bytes Func(2_bytes, 4_bytes) */
  154. enum { uppNameFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  155. enum { uppZoneFilterProcInfo = 0x000000E0 };                     /* pascal 2_bytes Func(4_bytes) */
  156. #define NewDialogHookProc(userRoutine)                             (DialogHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDialogHookProcInfo, GetCurrentArchitecture())
  157. #define NewNameFilterProc(userRoutine)                             (NameFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppNameFilterProcInfo, GetCurrentArchitecture())
  158. #define NewZoneFilterProc(userRoutine)                             (ZoneFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppZoneFilterProcInfo, GetCurrentArchitecture())
  159. #define CallDialogHookProc(userRoutine, item, theDialog)         CALL_TWO_PARAMETER_UPP((userRoutine), uppDialogHookProcInfo, (item), (theDialog))
  160. #define CallNameFilterProc(userRoutine, theEntity)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppNameFilterProcInfo, (theEntity))
  161. #define CallZoneFilterProc(userRoutine, theZone)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppZoneFilterProcInfo, (theZone))
  162. EXTERN_API( CTBUErr )
  163. InitCTBUtilities                (void);
  164.  
  165. EXTERN_API( short )
  166. CTBGetCTBVersion                (void);
  167.  
  168. EXTERN_API( short )
  169. StandardNBP                        (Point                     where,
  170.                                  ConstStr255Param         prompt,
  171.                                  short                     numTypes,
  172.                                  NLType                 typeList,
  173.                                  NameFilterUPP             nameFilter,
  174.                                  ZoneFilterUPP             zoneFilter,
  175.                                  DialogHookUPP             hook,
  176.                                  NBPReply *                theReply);
  177.  
  178. EXTERN_API( short )
  179. CustomNBP                        (Point                     where,
  180.                                  ConstStr255Param         prompt,
  181.                                  short                     numTypes,
  182.                                  NLType                 typeList,
  183.                                  NameFilterUPP             nameFilter,
  184.                                  ZoneFilterUPP             zoneFilter,
  185.                                  DialogHookUPP             hook,
  186.                                  long                     userData,
  187.                                  short                     dialogID,
  188.                                  ModalFilterUPP         filter,
  189.                                  NBPReply *                theReply);
  190.  
  191. #if OLDROUTINENAMES
  192. #define NuLookup(where, prompt, numTypes, typeList, nameFilter, zoneFilter,    \
  193. hook, theReply)                                                                \
  194. StandardNBP(where, prompt, numTypes, typeList, nameFilter, zoneFilter,         \
  195. hook, theReply)
  196. #define NuPLookup(where, prompt, numTypes, typeList, nameFilter,                 \
  197. zoneFilter, hook, userData, dialogID, filter, theReply)                        \
  198. CustomNBP(where, prompt, numTypes, typeList, nameFilter,                         \
  199. zoneFilter, hook, userData, dialogID, filter, theReply)
  200. #endif  /* OLDROUTINENAMES */
  201.  
  202.  
  203. #if PRAGMA_STRUCT_ALIGN
  204.     #pragma options align=reset
  205. #elif PRAGMA_STRUCT_PACKPUSH
  206.     #pragma pack(pop)
  207. #elif PRAGMA_STRUCT_PACK
  208.     #pragma pack()
  209. #endif
  210.  
  211. #ifdef PRAGMA_IMPORT_OFF
  212. #pragma import off
  213. #elif PRAGMA_IMPORT
  214. #pragma import reset
  215. #endif
  216.  
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220.  
  221. #endif /* __CTBUTILITIES__ */
  222.  
  223.